package com.example.inflection.controller;


import com.example.inflection.entity.Local;
import com.example.inflection.mapper.LocalMapper;
import com.example.inflection.service.LocalService;
import com.example.inflection.vo.CountyVO;
import com.example.inflection.vo.LineVO;
import com.example.inflection.vo.StateVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wu
 * @since 2021-05-15
 */
@RestController
@RequestMapping("//local")
public class LocalController {

    @Autowired
    private LocalService localService;
    @Autowired
    private LocalMapper localMapper;

    /*累积感染死亡和病死率*/
    @GetMapping("/total")
    public Local total(){ return localService.total(); }
    /*全国地图数据地图数据*/
    @GetMapping("/statemap")
    public StateVO geo(){
        return localService.geo();
    }
    /*病死率折线图*/
    @GetMapping("/line")
    public LineVO line(){ return localService.cfr(); }
    /*州地图数据*/
    @GetMapping("/countymap")
    public CountyVO state(String state){ return localService.search(state); }
    /*区数据,感染死亡感染率*/
    @GetMapping("/countydate")
    public List<Local> county(){return localService.excel();}
    /*搜索框中州的数据*/
    @GetMapping("/searchstateline")
    public LineVO searchstateline(String state){
        return localService.searchstateline(state);
    }
    /*某个州中各区的数据*/
    @GetMapping("/detaildata")
    public List<Local> detaildata(String state){
        return localService.detaildata(state);
    }
    /*所有州名*/
    @GetMapping("/allstate")
    public List<String> allstate(){
        return localMapper.findstatename();
    }
}

